<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('学习收藏列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>用户名称：</label>
                            <input type="text" name="userName"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('module:collect:edit')}]];
    var removeFlag = [[${@permission.hasPermi('module:collect:remove')}]];
    var prefix = ctx + "module/collect";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "学习收藏",
            showToggle: false,
            showColumns: false,
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'userName',
                    title: '用户名称'
                },
                {
                    field: 'newId',
                    title: '学习id',
                    visible: false
                },
                {
                    field: 'newTitle',
                    title: '学习标题'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="look(\'' + row.newId + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
                       // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function look(newId) {
        var url = ctx + "module/newsLearn/detail/" + newId;
        var index = layer.open({
            type: 2,
            title:"查看详情",
            area: ['600px', '600px'],
            fix: false,
            //不固定
            maxmin: true,
            shade: 0.3,
            content: url,
            btn: ['关闭'],
            // 弹层外区域关闭
            shadeClose: true,
            yes: function (index, layero) {
                layer.close(index);
            }
        });
       layer.full(index);
    }
</script>
</body>
</html>